var t=0;
var timeout = 10800;
$(document).ready(function(){
    countDown();
});

function countDown()
{
	if(timeout==0)
	{
		document.getElementById('timeleft').innerHTML = "Sesja wygasła";
                clearTimeout(t);
	}
	else
	{
                var hours = parseInt(timeout/3600);
		var mins = parseInt((timeout-hours*3600)/60);
		var secs = timeout - hours*3600 - mins*60;
                    
                if(hours < 10)
                    hours = '0'+hours;
                if(mins < 10)
                    mins = '0'+mins;
                if(secs < 10)
                    secs = '0'+secs;
		document.getElementById('timeleft').innerHTML = hours + ':' + mins + ':' + secs;
		t=setTimeout("countDown()",1000);
                timeout--;
	}
}
